package com.example.reactor.r2dbc.db.factory;

import com.example.reactor.r2dbc.db.Customer;
import com.example.reactor.r2dbc.db.CustomerRepository;
import jakarta.annotation.Resource;
import reactor.core.publisher.Flux;

/**
 * @author zpMeng
 * @since 6/16/2025
 */
//@Service
public class CustomizeRepositoryService {
    @Resource
    private DynamicRepositoryFactory repoFactory;

    public Flux<Customer> loadFromTable(String tableName) {
        CustomerRepository repo = repoFactory.createRepository(
                CustomerRepository.class, tableName
        );
        return repo.findAll();
    }
}
